package com.itheima.web.listener;

import com.itheima.domain.db.Log;
import com.itheimma.service.db.LogService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(consumerGroup = "user-log-groupd" ,topic = "tanhua-user-log")
public class LogMessageListener implements RocketMQListener<Log> {

    @DubboReference
    private LogService logService;

    @Override
    public void onMessage(Log message) {
        System.out.println(message);
        //保存日志
        logService.saveLog(message);
    }
}
